// MESSAGE ASCTEC_STICK_COMMAND PACKING

#define MAVLINK_MSG_ID_ASCTEC_STICK_COMMAND 6

typedef struct __mavlink_asctec_stick_command_t
{
 int16_t roll; ///<  roll angle
 int16_t pitch; ///<  pitch angle
 int16_t yaw; ///<  yaw rate 
 uint16_t thrust; ///<  thrust value
} mavlink_asctec_stick_command_t;

#define MAVLINK_MSG_ID_ASCTEC_STICK_COMMAND_LEN 8
#define MAVLINK_MSG_ID_6_LEN 8



#define MAVLINK_MESSAGE_INFO_ASCTEC_STICK_COMMAND { \
	"ASCTEC_STICK_COMMAND", \
	4, \
	{  { "roll", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_asctec_stick_command_t, roll) }, \
         { "pitch", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_asctec_stick_command_t, pitch) }, \
         { "yaw", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_asctec_stick_command_t, yaw) }, \
         { "thrust", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_asctec_stick_command_t, thrust) }, \
         } \
}


/**
 * @brief Pack a asctec_stick_command message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param roll  roll angle
 * @param pitch  pitch angle
 * @param yaw  yaw rate 
 * @param thrust  thrust value
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_asctec_stick_command_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       int16_t roll, int16_t pitch, int16_t yaw, uint16_t thrust)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[8];
	_mav_put_int16_t(buf, 0, roll);
	_mav_put_int16_t(buf, 2, pitch);
	_mav_put_int16_t(buf, 4, yaw);
	_mav_put_uint16_t(buf, 6, thrust);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 8);
#else
	mavlink_asctec_stick_command_t packet;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.thrust = thrust;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 8);
#endif

	msg->msgid = MAVLINK_MSG_ID_ASCTEC_STICK_COMMAND;
	return mavlink_finalize_message(msg, system_id, component_id, 8, 142);
}

/**
 * @brief Pack a asctec_stick_command message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message was sent over
 * @param msg The MAVLink message to compress the data into
 * @param roll  roll angle
 * @param pitch  pitch angle
 * @param yaw  yaw rate 
 * @param thrust  thrust value
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_asctec_stick_command_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           int16_t roll,int16_t pitch,int16_t yaw,uint16_t thrust)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[8];
	_mav_put_int16_t(buf, 0, roll);
	_mav_put_int16_t(buf, 2, pitch);
	_mav_put_int16_t(buf, 4, yaw);
	_mav_put_uint16_t(buf, 6, thrust);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 8);
#else
	mavlink_asctec_stick_command_t packet;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.thrust = thrust;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 8);
#endif

	msg->msgid = MAVLINK_MSG_ID_ASCTEC_STICK_COMMAND;
	return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 8, 142);
}

/**
 * @brief Encode a asctec_stick_command struct into a message
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param asctec_stick_command C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_asctec_stick_command_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_asctec_stick_command_t* asctec_stick_command)
{
	return mavlink_msg_asctec_stick_command_pack(system_id, component_id, msg, asctec_stick_command->roll, asctec_stick_command->pitch, asctec_stick_command->yaw, asctec_stick_command->thrust);
}

/**
 * @brief Send a asctec_stick_command message
 * @param chan MAVLink channel to send the message
 *
 * @param roll  roll angle
 * @param pitch  pitch angle
 * @param yaw  yaw rate 
 * @param thrust  thrust value
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_asctec_stick_command_send(mavlink_channel_t chan, int16_t roll, int16_t pitch, int16_t yaw, uint16_t thrust)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[8];
	_mav_put_int16_t(buf, 0, roll);
	_mav_put_int16_t(buf, 2, pitch);
	_mav_put_int16_t(buf, 4, yaw);
	_mav_put_uint16_t(buf, 6, thrust);

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASCTEC_STICK_COMMAND, buf, 8, 142);
#else
	mavlink_asctec_stick_command_t packet;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.thrust = thrust;

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASCTEC_STICK_COMMAND, (const char *)&packet, 8, 142);
#endif
}

#endif

// MESSAGE ASCTEC_STICK_COMMAND UNPACKING


/**
 * @brief Get field roll from asctec_stick_command message
 *
 * @return  roll angle
 */
static inline int16_t mavlink_msg_asctec_stick_command_get_roll(const mavlink_message_t* msg)
{
	return _MAV_RETURN_int16_t(msg,  0);
}

/**
 * @brief Get field pitch from asctec_stick_command message
 *
 * @return  pitch angle
 */
static inline int16_t mavlink_msg_asctec_stick_command_get_pitch(const mavlink_message_t* msg)
{
	return _MAV_RETURN_int16_t(msg,  2);
}

/**
 * @brief Get field yaw from asctec_stick_command message
 *
 * @return  yaw rate 
 */
static inline int16_t mavlink_msg_asctec_stick_command_get_yaw(const mavlink_message_t* msg)
{
	return _MAV_RETURN_int16_t(msg,  4);
}

/**
 * @brief Get field thrust from asctec_stick_command message
 *
 * @return  thrust value
 */
static inline uint16_t mavlink_msg_asctec_stick_command_get_thrust(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint16_t(msg,  6);
}

/**
 * @brief Decode a asctec_stick_command message into a struct
 *
 * @param msg The message to decode
 * @param asctec_stick_command C-struct to decode the message contents into
 */
static inline void mavlink_msg_asctec_stick_command_decode(const mavlink_message_t* msg, mavlink_asctec_stick_command_t* asctec_stick_command)
{
#if MAVLINK_NEED_BYTE_SWAP
	asctec_stick_command->roll = mavlink_msg_asctec_stick_command_get_roll(msg);
	asctec_stick_command->pitch = mavlink_msg_asctec_stick_command_get_pitch(msg);
	asctec_stick_command->yaw = mavlink_msg_asctec_stick_command_get_yaw(msg);
	asctec_stick_command->thrust = mavlink_msg_asctec_stick_command_get_thrust(msg);
#else
	memcpy(asctec_stick_command, _MAV_PAYLOAD(msg), 8);
#endif
}
